import 'package:app/router/router.dart';
import 'package:flutter/material.dart';

extension Context on BuildContext {
  Future<T?> routerTo<T extends Object?>(Type router) {
    return UserRouter.routeTo(this, router);
  }

  RT routeOf<RT extends RouterBridge>() {
    assert(
      RT != RouterBridge<dynamic>,
      "You must specify the route type, for example: \"context.routeOf<Page>()\";",
    );
    return UserRouter.of<RT>(this);
  }
}
